<?php
header("Content-Type: text/json; charset=utf-8");

require_once ("../../core/cfg.php");
require_once ("../../core/functions.php");

if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) ? $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' : false)
{
	$r =& Registry::get("MDB")->query("SELECT `ID`,`Name` FROM `".PRFX."mail` WHERE `Show`='1' ORDER BY `Por`;");
	if (PEAR::isError($r)) {
		die($r->getMessage().' ::: '.$r->getUserInfo());
	}
	if($r->numRows())
	{
		while($p = $r->fetchRow(MDB2_FETCHMODE_ASSOC)) {
			$json[$p["id"]] = $p["name"];
		}	
		exit(getJSON($json));
	}	
}


?> 